import {Button} from "antd";
import {useDispatch, useSelector} from "react-redux";
import {sub, add} from "../../store/modules/countStore";

const Count = () => {
    const count = useSelector(state => state.countStore.count)

    const dispatch = useDispatch()
    return (
        <div className="count">
            <Button type="primary" onClick={() => dispatch(sub(10))}>-</Button>
            <Button type="primary">{count}</Button>
            <Button type="primary" onClick={() => dispatch(add(10))}>+</Button>
        </div>
    )
}

export default Count;
